var chokidar = require('chokidar');
var shelljs = require('shelljs');

chokidar.watch('./', {ignored: /(^|[\/\\])\../}).on('all', (event, path) => {
    console.log(event, path)
    if (event == "change" && path.indexOf(".js") > 0) {
        'use strict';
         console.log("js2coffee "+path+" > index.coffee")
         shelljs.exec("js2coffee "+path+" > index.coffee");
        //shelljs.exit(1);   执行完就退出
    }
})
